package com.ruoyi.qywx.getway.keys;

import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.utils.sign.Md5Utils;

/**
 * @author : hcl
 * @Date : 2023/8/22 11:54
 */
public class QywxKey {
    public static final String TYPE = "type";
    public static final String TITLE = "title";
    public static final String CONTENT = "content";
    public static final String URL = "url";
    public static final String PAGE = "page";
    public static final String APPID = "appid";
    public static final String MEDIA_ID = "media_id";
    public static final String MSG_TYPE = "msgtype";
    public static final String NAME = "name";
    public static final String TEXT = "text";
    public static final String DESC = "desc";
    public static final String PIC_URL = "picurl";
    public static final String PIC_MEDIA_ID = "pic_media_id";
    public static final String ATTACHEMENTS = "attachments";


    public static class RedisKey {
        /**
         * 联系我欢迎语 redis key
         */
        public static String extContactWelcomeKey(Long teamId, String state) {
            return CacheConstants.QY_WELCOME + "wel_" + teamId + "_" + state;
        }

        /**
         * 全局欢迎语 redis key
         */
        public static String extContactPubWelcomeKey(Long teamId, String userId) {
            return CacheConstants.QY_WELCOME + "wel_" + teamId + "_pub_" + userId;
        }

        public static String temporaryMediaKey(String url) {
            return CacheConstants.QYWX_MEDIA + "QY_MEDIA_" + Md5Utils.hash(url);
        }

        public static String groupChatUpMembers(Long teamId, Long chatId) {
            return CacheConstants.QY_LAZY_UPDATE + "GROUP_CHAT_" + teamId + "_" + chatId;
        }

        public static String activityKey(String activity, String obj) {
            return CacheConstants.QY_ACTIVITY + activity + "_" + obj;
        }
    }
}
